<?php
namespace Acme\TaskBundle\Form\Type;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;

class TaskType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('task', 'textarea', array('required' => false))
            ->add('dueDate', 'date', array('widget' => 'single_text', 'label' => 'Due Date', 'required' => false))
            ->add('gender_code', 'gender', array('mapped' => false))
            ->add('save', 'submit')
            ->add('saveAndAdd', 'submit')
            ->add('category', new CategoryType(), array('required' => false))
            ->add('email', 'email',  array('mapped' => false))
            ->add('integer', 'integer',  array('mapped' => false))
            ->add('money', 'money', array('currency' => 'CNY', 'mapped' => false))
            ->add('number', 'number',  array('mapped' => false))
            ->add('password', 'password',  array('mapped' => false))
            ->add('percent', 'percent',  array('mapped' => false))
            ->add('search', 'search',  array('mapped' => false))
            ->add('url', 'url',  array('mapped' => false))
            ->add('choice', 'choice',  array('mapped' => false))
            ->add('country', 'country',  array('mapped' => false))
            ->add('language', 'language',  array('mapped' => false))
            ->add('locale', 'locale',  array('mapped' => false))
            ->add('timezone', 'timezone',  array('mapped' => false))
            ->add('currency', 'currency',  array('mapped' => false))
            ->add('date', 'date',  array('mapped' => false))
            ->add('datetime', 'datetime',  array('mapped' => false))
            ->add('time', 'time',  array('mapped' => false))
            ->add('birthday', 'birthday',  array('mapped' => false))
            ->add('checkbox', 'checkbox',  array('mapped' => false))
            ->add('form', 'form',  array('mapped' => false))
            ->add('emails', 'collection', array(
                                            'type'   => 'email',
                                            'options'  => array(
                                                            'required'  => false,
                                                            'attr'      => array('class' => 'email-box')
                                            ), 'mapped' => false
            ))
            
            
            
            
            ;
    }

    public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        $resolver->setDefaults(array(
            'data_class' => 'Acme\TaskBundle\Entity\Task',
            'cascade_validation' => true,
        ));
    }
    
    public function getName()
    {
        return 'task';
    }
}